﻿namespace SmartSoft.Controls.ChildGridControls
{
    using System;
    using System.ComponentModel;
    using System.Windows.Forms;

    public class StatusColumn : DataGridViewColumn
    {
        private int ii_StatusField;

        public StatusColumn() : base(new StatusCell())
        {
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.DefaultCellStyle = style;
        }

        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
            {
                if ((value == null) || !(value is StatusCell))
                {
                    throw new ArgumentException("Invalid cell type, StatusColumns can only contain StatusCells");
                }
            }
        }

        [Browsable(false)]
        public int StatusField
        {
            get
            {
                return this.ii_StatusField;
            }
            set
            {
                if (this.ii_StatusField != value)
                {
                    this.ii_StatusField = value;
                }
            }
        }
    }
}

